
<template>
		<view class="item"  >
      <view class="a2">
      <image src="/static/tab_icons/Plus.png" style="width:30px ;height:30px" @click="add"></image>
      </view>
				<view class="thumb"  v-for="(item,index) in tableData" :key="item.id">
          <view class="a1" >
				<text  @click="zoneList(3,index)">{{item.zoneName}}</text>
				<view class="button-a">
					<button @click="test(item.id)" >修改</button>
					<button @click="test(item.id)" >删除</button>
				</view>
        </view>
				</view>
		</view>
	
</template>

<script>
	export default {
		data() {
			return {
				token:"",
				tableData:[
				// 	id:'',
				// 	zoneName:'',
				// 	createDate:'',
				// 	province:'',
				// 	urban:'',
				// 	address:'',
				// 	isDelete:''
				]
			}
		},
		methods: {
			zoneList(op,d){
				uni.request({
					url:"http://139.198.187.252:8081/zoneList",
					method:"GET",
					header:{"Authorization":uni.getStorageSync("token")},
					success:res=> {
						// uni.setStorageSync('id',res.data.id)
						this.tableData=res.data.data
						if(op===3){
							uni.navigateTo({
								url:'manage/manage'+"?id="+res.data.data[d].id
							})
						}
							
						console.log(res)
					}
				})
			},
			test(id){
				uni.request({
					url:"http://139.198.187.252:8081/delete/ "+ id,
					method:"DELETE",
					header:{"Authorization":uni.getStorageSync("token")},
					success:res=> {
						console.log(res)
					},
					fail(error){
						console.log(error)
					}
				})
				console.log(id)
			},
			add(){
				uni.navigateTo({
					url:'/pkg/add-a/add-a'
				})
			}
		}
		,created() {
			this.token =  uni.getStorage({
				key:"token"
			})
			console.log(this.token)
			this.zoneList(10)
		}
	}
</script>

<style>
.item{
  
	padding: 15rpx;
	border: 1rpx solid #efefef;
	border-radius: 8rpx;
	margin: 15rpx;
	box-shadow:1rpx 1rpx 15rpx #ddd ;
	justify-content: space-around;
}
.a1{
  display: flex;
  margin-left:30rpx
}
.a2{
  display: flex;
  margin-left: 640rpx;
}

.thumb text{
	
	width: 250rpx;
	height: 125rpx;
	margin-right: 15rpx;
	line-height: 125rpx;
	/* padding-left: 33.3%; */
	font-size: 24px;
	 color: #AD8665;
}
.button-a{
	height: 75rpx;
	line-height: 125rpx;
	display: flex;
  margin-left:60rpx
}
button{
	margin: 20rpx;
	margin-left: 20rpx;
	line-height: 80rpx;
	height: 80rpx;
}
</style>
